const OSS = require('ali-oss');

let client = new OSS({
        region: 'oss-cn-beijing',
        accessKeyId: 'LTAI5tEEs4rwHXgWDkXfq27A',
        accessKeySecret: '5P5lOmEoMKqxHkLren4625ajUcp5ap',
        bucket: '2021323',
});

export const put = async (ObjName, fileUrl) => {
        try {
                let result = await client.put(`image/${ObjName}`, fileUrl)
                return result
        } catch (e) {
                console.log(e)
        }
};
/*export const deletefile = async (fileUrl) =>{
    try {
      let result = await client.delete(fileUrl);
      console.log('成功')
      console.log(result);
    } catch (e) {
      console.log(e);
    }
}*/

export const getFileNameUUID = () => {
        function rx() {
                return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
        }
        return `${+new Date()}_${rx()}${rx()}`
}




